Skip to content

[Everyday C#] Phase E, PR 14a: Statements: collections + LINQ#54807

Merged
BillWagner merged 9 commits into
dotnet:mainfrom
BillWagner:squad/53556-statements-collections-linq
Jul 20, 2026
Merged

[Everyday C#] Phase E, PR 14a: Statements: collections + LINQ#54807
BillWagner merged 9 commits into
dotnet:mainfrom
BillWagner:squad/53556-statements-collections-linq

Conversation

@BillWagner

@BillWagner BillWagner commented Jul 15, 2026

Copy link
Copy Markdown
Member

Everyday C# — Phase E, PR 14a: Statements: collections + LINQ

Closes #53556

Adds two example-heavy Fundamentals concept articles under fundamentals/statements/, each backed by a compiling net10.0 snippet project, and wires them into the TOC. Every code sample is included from an external snippet via :::code regions and shows its result as a trailing // => comment; the samples saturate the everyday feature set (collection expressions, file-scoped namespaces, nullable enabled, target-typed new).

New articles

  • fundamentals/statements/collections.md — arrays, List<T>, Dictionary<TKey,TValue>; adding, removing, and searching elements; collection expressions (C# 12); indexes and ranges (C# 8) applied to collections. Introduces collection, element, sequence vs map, generic type / type safety, index, range, and collection expression at first use.
  • fundamentals/statements/linq.md — query syntax and method (fluent) syntax; the functional trio filter / map / reduce mapped to Where / Select / Aggregate·Sum·Count, plus OrderBy and GroupBy; lambda (anonymous function) expressions in LINQ; deferred execution vs eager evaluation. Names LINQ providers as a first-class use and links out for provider-based queries.

TOC

Collections and LINQ added under Fundamentals → Expressions and statements, after Iteration statements.

Scope discipline — deliberately left out of Fundamentals (link-out targets)

No existing content was cut (both articles are new); the following advanced topics are intentionally kept out of Fundamentals and linked to their proper homes, per Goal 11 / Filter A:

  • collections.mdlanguage-reference/builtin-types/arrays.md / collections.md → multidimensional arrays, covariance, collection taxonomy are reference-level.
  • collections.mdlanguage-reference/operators/collection-expressions.md / member-access-operators.md → conversion/spread rules and full []/^/.. operator rules are reference-level.
  • collections.mdstandard/collections/* → choosing among specialized/concurrent/immutable collections and custom comparers fail universality.
  • linq.mdlinq/* (LINQ section) → joins, providers/IQueryable, deferred-execution mechanics, custom operators, XML/EF behavior are LINQ-focus material.
  • linq.md → PLINQ / expression trees / performance → parallel and advanced-representation material.

Validation

  • Both snippet projects build clean (0 warnings, 0 errors) on net10.0; every // => output verified by running the programs.
  • All relative links, the #indexer-operator- anchor, and all <xref:...> UIDs verified to resolve; version claims (collection expressions → C# 12, ^/.. → C# 8) confirmed.
  • No programming-guide/* link destinations (that area is slated for retirement).

Opened as draft for review.


Internal previews

📄 File 🔗 Preview link
docs/csharp/fundamentals/statements/collections.md Common collection types
docs/csharp/fundamentals/statements/linq.md "LINQ queries in C#"
docs/csharp/toc.yml Taken from https://github.com/dotnet/roslyn/wiki/Samples-and-Walkthroughs

Phase E, PR 14a. Adds two example-heavy Fundamentals concept articles
under fundamentals/statements/ with compiling net10.0 snippet projects:

- collections.md: arrays, List<T>, Dictionary<TKey,TValue>, adding/
  removing/searching elements, collection expressions (C# 12), indexes
  and ranges (C# 8).
- linq.md: query syntax, method syntax, filter/map/reduce/sort/group,
  lambda expressions, deferred vs eager evaluation.

Adds Collections and LINQ entries to the Expressions and statements TOC
node. Advanced topics (providers, IQueryable, expression trees, PLINQ,
performance, custom collections/operators) are intentionally left to the
Language Reference and LINQ sections and linked out.

Closes dotnet#53556

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7f9f7f68-82b8-43d2-a511-1a4f07138403
Copilot AI review requested due to automatic review settings July 15, 2026 18:36
@dotnetrepoman dotnetrepoman Bot added this to the July 2026 milestone Jul 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds two new “Everyday C#” Fundamentals concept articles under fundamentals/statements/ (Collections and LINQ), backed by new compiling snippet projects, and wires both pages into the C# TOC.

Changes:

  • Adds new Fundamentals articles: Collections and LINQ queries.
  • Adds new snippet projects (collections-statements and linq-statements) that supply all referenced :::code regions.
  • Updates docs/csharp/toc.yml to include the new pages under Fundamentals → Expressions and statements.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docs/csharp/toc.yml Adds TOC entries for the new Collections and LINQ Fundamentals pages.
docs/csharp/fundamentals/statements/collections.md New concept article introducing arrays, List<T>, dictionaries, collection expressions, and indexes/ranges with snippet-backed examples.
docs/csharp/fundamentals/statements/linq.md New concept article introducing LINQ query/method syntax, common operators, grouping, and deferred execution with snippet-backed examples.
docs/csharp/fundamentals/statements/snippets/collections-statements/Program.cs Snippet source for the Collections article :::code regions.
docs/csharp/fundamentals/statements/snippets/collections-statements/collections-statements.csproj New net10.0 snippet project for Collections examples.
docs/csharp/fundamentals/statements/snippets/linq-statements/Program.cs Snippet source for the LINQ article :::code regions.
docs/csharp/fundamentals/statements/snippets/linq-statements/linq-statements.csproj New net10.0 snippet project for LINQ examples.

Comment thread docs/csharp/fundamentals/statements/linq.md Outdated
BillWagner and others added 5 commits July 15, 2026 14:57
Rename collections.md H1/title to "Arrays, lists, and dictionaries" to
resolve the duplicate-H1 build warning, and collapse multiple-blank-line
runs (MD012) in both statements articles.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7f9f7f68-82b8-43d2-a511-1a4f07138403
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7f9f7f68-82b8-43d2-a511-1a4f07138403
This is looking a little better.
@BillWagner
BillWagner marked this pull request as ready for review July 16, 2026 19:45
@BillWagner
BillWagner requested a review from a team as a code owner July 16, 2026 19:45

@adegeo adegeo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good! I wrote my comments as if talking to LLM, so they're curt.

Comment thread docs/csharp/fundamentals/statements/snippets/collections-statements/Program.cs Outdated
Comment thread docs/csharp/fundamentals/statements/collections.md Outdated
Comment thread docs/csharp/fundamentals/statements/collections.md Outdated
Comment thread docs/csharp/fundamentals/statements/collections.md Outdated
Comment thread docs/csharp/fundamentals/statements/collections.md
Comment thread docs/csharp/fundamentals/statements/linq.md Outdated
Comment thread docs/csharp/fundamentals/statements/linq.md
Comment thread docs/csharp/fundamentals/statements/linq.md Outdated
Comment thread docs/csharp/fundamentals/statements/linq.md
Comment thread docs/csharp/fundamentals/statements/linq.md
Respond to review feedback.

@adegeo adegeo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Two more minor things to fix.

Comment thread docs/csharp/fundamentals/statements/collections.md Outdated
Comment thread docs/csharp/fundamentals/statements/linq.md Outdated
BillWagner and others added 2 commits July 20, 2026 17:26
…LINQ cross-reference wording

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ection'

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@BillWagner
BillWagner merged commit 95d7525 into dotnet:main Jul 20, 2026
9 checks passed
@BillWagner
BillWagner deleted the squad/53556-statements-collections-linq branch July 20, 2026 21:49
BillWagner added a commit that referenced this pull request Jul 21, 2026
Update the rules and comments based on everything learned in PR #54807
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Everyday C#] - Phase E, PR 14a. Statements: collections + LINQ

3 participants